package net.sea.setup.ui.wizard.factory;

import net.sea.commons.constants.AppConstants;
import net.sea.setup.ui.wizard.factory.db.IDBType;
import net.sea.setup.ui.wizard.factory.db.impl.DB2;
import net.sea.setup.ui.wizard.factory.db.impl.MySQL;
import net.sea.setup.ui.wizard.factory.db.impl.Oracle;
import net.sea.setup.ui.wizard.factory.db.impl.SQLServer;

/**
 * 数据库工厂
 * 
 * @author 华成伍
 *
 */
public class DBFactory {
	/**
	 * 根据数据库类型获取数据库类对象
	 * 
	 * @param dbType
	 *            数据库类型
	 * @return 数据库类对象
	 */
	public static IDBType createDB(String dbType) {
		IDBType db = null;
		if (AppConstants.DB_ORACLE.equals(dbType)) {
			db = new Oracle();
		} else if (AppConstants.DB_MYSQL.equals(dbType)) {
			db = new MySQL();
		} else if (AppConstants.DB_DB2.equals(dbType)) {
			db = new DB2();
		} else if (AppConstants.DB_SQLSERVER.equals(dbType)) {
			db = new SQLServer();
		}
		return db;
	}
}
